import 'package:flutter_shop/generated/json/base/json_convert_content.dart';

/// Title:常规结果接收 <br/>
/// Description: <br/>
/// author:xiemiao <br/>
/// date: 2020-04-03  <br/>
/// version 1.0 <br/>
class CommonResult<T> {
  String code;
  String message;
  T data;

  CommonResult({this.code, this.message, this.data});

  CommonResult.fromJson(Map<String, dynamic> json) {
    code = json['code'];
    message = json['message'];
    data = JsonConvert.fromJsonAsT<T>(json['data']);
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['code'] = this.code;
    data['message'] = this.message;
    if (this.data != null) {
      data['data'] = (this.data as JsonConvert).toJson();
    }
    return data;
  }
}
